home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / NDK / NDK_3.5 / Include / include_i / devices / cd.i < prev    next >
Encoding:
Text File  |  1999-10-20  |  11.6 KB  |  310 lines

  1.     IFND    DEVICES_CD_I
  2. DEVICES_CD_I SET    1
  3. **
  4. **    $VER: cd.i 40.12 (12.8.1993)
  5. **    Includes Release 44.1
  6. **
  7. **    cd.device include file
  8. **
  9. **    (C) Copyright 1992-1999 Amiga, Inc.
  10. **        All Rights Reserved
  11. **
  12.  
  13.     INCLUDE "exec/types.i"
  14.     INCLUDE "exec/nodes.i"
  15.  
  16. ************************************************************************
  17. *                                       *
  18. *   CD Commands                               *
  19. *                                       *
  20. ************************************************************************
  21.  
  22. CD_RESET        equ  1
  23. CD_READ        equ  2
  24. CD_WRITE        equ  3
  25. CD_UPDATE        equ  4
  26. CD_CLEAR        equ  5
  27. CD_STOP        equ  6
  28. CD_START        equ  7
  29. CD_FLUSH        equ  8
  30. CD_MOTOR        equ  9
  31. CD_SEEK        equ 10
  32. CD_FORMAT        equ 11
  33. CD_REMOVE        equ 12
  34. CD_CHANGENUM        equ 13
  35. CD_CHANGESTATE        equ 14
  36. CD_PROTSTATUS        equ 15
  37.  
  38. CD_GETDRIVETYPE     equ 18
  39. CD_GETNUMTRACKS     equ 19
  40. CD_ADDCHANGEINT     equ 20
  41. CD_REMCHANGEINT     equ 21
  42. CD_GETGEOMETRY        equ 22
  43. CD_EJECT        equ 23
  44.  
  45.  
  46. CD_INFO        equ 32
  47. CD_CONFIG        equ 33
  48. CD_TOCMSF        equ 34
  49. CD_TOCLSN        equ 35
  50.  
  51. CD_READXL        equ 36
  52.  
  53. CD_PLAYTRACK        equ 37
  54. CD_PLAYMSF        equ 38
  55. CD_PLAYLSN        equ 39
  56. CD_PAUSE        equ 40
  57. CD_SEARCH        equ 41
  58.  
  59. CD_QCODEMSF        equ 42
  60. CD_QCODELSN        equ 43
  61. CD_ATTENUATE        equ 44
  62.  
  63. CD_ADDFRAMEINT        equ 45
  64. CD_REMFRAMEINT        equ 46
  65.  
  66. ************************************************************************
  67. *                                       *
  68. *   Device Driver Error Codes                           *
  69. *                                       *
  70. ************************************************************************
  71.  
  72. CDERR_OPENFAIL        equ -1        ; device/unit failed to open
  73. CDERR_ABORTED        equ -2        ; request terminated early
  74. CDERR_NOCMD        equ -3        ; command not supported by device
  75. CDERR_BADLENGTH    equ -4        ; invalid length (IO_LENGTH/IO_OFFSET)
  76. CDERR_BADADDRESS    equ -5        ; invalid address (IO_DATA misaligned)
  77. CDERR_UNITBUSY        equ -6        ; device opens ok, but unit is busy
  78. CDERR_SELFTEST        equ -7        ; hardware failed self-test
  79.  
  80. CDERR_NotSpecified    equ 20        ; general catchall
  81. CDERR_NoSecHdr        equ 21        ; couldn't even find a sector         
  82. CDERR_BadSecPreamble    equ 22      ; sector looked wrong                 
  83. CDERR_BadSecID          equ 23      ; ditto                               
  84. CDERR_BadHdrSum         equ 24      ; header had incorrect checksum       
  85. CDERR_BadSecSum         equ 25      ; data had incorrect checksum         
  86. CDERR_TooFewSecs        equ 26      ; couldn't find enough sectors
  87. CDERR_BadSecHdr    equ 27        ; another "sector looked wrong"
  88. CDERR_WriteProt    equ 28        ; can't write to a protected disk     
  89. CDERR_NoDisk            equ 29      ; no disk in the drive                
  90. CDERR_SeekError         equ 30      ; couldn't find track 0
  91. CDERR_NoMem        equ 31        ; ran out of memory
  92. CDERR_BadUnitNum    equ 32        ; asked for a unit > NUMUNITS
  93. CDERR_BadDriveType    equ 33        ; not a drive cd.device understands
  94. CDERR_DriveInUse    equ 34        ; someone else allocated the drive
  95. CDERR_PostReset    equ 35        ; user hit reset; awaiting doom
  96. CDERR_BadDataType    equ 36        ; data on disk is wrong type
  97. CDERR_InvalidState    equ 37        ; invalid cmd under current conditions
  98.  
  99. CDERR_Phase        equ 42        ; illegal or unexpected SCSI phase
  100. CDERR_NoBoard        equ 50        ; open failed for non-existant board
  101.  
  102.  
  103.  
  104. ************************************************************************
  105. *                                       *
  106. * Configuration                               *
  107. *                                       *
  108. *    The drive is configured by TagList items defined as follows:   *
  109. *                                       *
  110. ************************************************************************
  111.  
  112. TAGCD_PLAYSPEED    equ    $0001
  113. TAGCD_READSPEED    equ    $0002
  114. TAGCD_READXLSPEED    equ    $0003
  115. TAGCD_SECTORSIZE    equ    $0004
  116. TAGCD_XLECC        equ    $0005
  117. TAGCD_EJECTRESET    equ    $0006
  118.  
  119. ************************************************************************
  120. *                                       *
  121. * Information                                   *
  122. *                                       *
  123. *      Information/Status structure describes current speed settings   *
  124. *      for read and play commands, sector size, audio attenuation      *
  125. *      precision, and drive status.                       *
  126. *                                       *
  127. ************************************************************************
  128.  
  129.  STRUCTURE CDINFO,0
  130.                  ;                  Default
  131.     UWORD  CDINFO_PlaySpeed     ; Audio play speed          (75)
  132.     UWORD  CDINFO_ReadSpeed     ; Data-rate of CD_READ command   (Max)
  133.     UWORD  CDINFO_ReadXLSpeed     ; Data-rate of CD_READXL command (75)
  134.     UWORD  CDINFO_SectorSize     ; Number of bytes per sector      (2048)
  135.     UWORD  CDINFO_XLECC     ; CDXL ECC enabled/disabled
  136.     UWORD  CDINFO_EjectReset     ; Reset on eject enabled/disabled
  137.     STRUCT CDINFO_Reserved1,8     ; Reserved for future expansion
  138.  
  139.     UWORD  CDINFO_MaxSpeed     ; Maximum speed drive can handle (75, 150)
  140.     UWORD  CDINFO_AudioPrecision ; 0 = no attenuator, 1 = mute only,
  141.                  ; other = (# levels - 1)
  142.     UWORD  CDINFO_Status     ; See flags below
  143.     STRUCT CDINFO_Reserved2,8     ; Reserved for future expansion
  144.  
  145.     LABEL  CDINFO_SIZE
  146.  
  147.  
  148. ; Flags for Status
  149.  
  150. CDSTSB_CLOSED        equ 0     ; Drive door is closed
  151. CDSTSB_DISK        equ 1     ; A disk has been detected
  152. CDSTSB_SPIN        equ 2     ; Disk is spinning (motor is on)
  153. CDSTSB_TOC        equ 3     ; Table of contents read.  Disk is valid.
  154. CDSTSB_CDROM        equ 4     ; Track 1 contains CD-ROM data
  155. CDSTSB_PLAYING        equ 5     ; Audio is playing
  156. CDSTSB_PAUSED        equ 6     ; Pause mode (pauses on play command)
  157. CDSTSB_SEARCH        equ 7     ; Search mode (Fast Forward/Fast Reverse)
  158. CDSTSB_DIRECTION    equ 8     ; Search direction (0 = Forward, 1 = Reverse)
  159.  
  160. CDSTSF_CLOSED        equ $0001
  161. CDSTSF_DISK        equ $0002
  162. CDSTSF_SPIN        equ $0004
  163. CDSTSF_TOC        equ $0008
  164. CDSTSF_CDROM        equ $0010
  165. CDSTSF_PLAYING        equ $0020
  166. CDSTSF_PAUSED        equ $0040
  167. CDSTSF_SEARCH        equ $0080
  168. CDSTSF_DIRECTION    equ $0100
  169.  
  170. ; Modes for CD_SEARCH
  171.  
  172. CDMODE_NORMAL    equ 0        ; Normal play at current play speed
  173. CDMODE_FFWD    equ 1        ; Fast forward play (skip-play forward
  174. CDMODE_FREV    equ 2        ; Fast reverse play (skip-play reverse
  175.  
  176.  
  177. ************************************************************************
  178. *                                       *
  179. * Position Information                               *
  180. *                                       *
  181. *      Position information can be described in two forms: MSF and LSN *
  182. *      form.  MSF (Minutes, Seconds, Frames) form is a time encoding.  *
  183. *      LSN (Logical Sector Number) form is frame (sector) count.       *
  184. *      The desired form is selected using the io_Flags field of the    *
  185. *      IOStdReq structure.  The flags and the union are described      *
  186. *      below.                                   *
  187. *                                       *
  188. ************************************************************************
  189.  
  190.  STRUCTURE RMSF,0
  191.  
  192.     UBYTE   Reserved        ; Reserved (always zero)
  193.     UBYTE   Minute        ; Minutes (0-72ish)
  194.     UBYTE   Second        ; Seconds (0-59)
  195.     UBYTE   Frame        ; Frame   (0-74)
  196.     LABEL   RMSF_SIZE
  197.  
  198. ;UNION
  199.  
  200. LSNMSF_SIZE    equ RMSF_SIZE
  201.  
  202.  
  203. ************************************************************************
  204. *                                       *
  205. * CD Transfer Lists                               *
  206. *                                       *
  207. *      A CDXL node is a double link node; however only single linkage  *
  208. *      is used by the device driver.  If you wish to construct a       *
  209. *      transfer list manually, it is only neccessary to define the     *
  210. *      mln_Succ pointer of the MinNode.  You may also use the Exec     *
  211. *      list functions by defining a List or MinList structure and by   *
  212. *      using the AddHead/AddTail functions to create the list.    This   *
  213. *      will create a double-linked list.  Although a double-linked     *
  214. *      list is not required by the device driver, you may wish use it  *
  215. *      for your own purposes.  Don't forget to initialize the          *
  216. *      the List/MinList before using it!                               *
  217. *                                                                      *
  218. ************************************************************************
  219.  
  220.  STRUCTURE CDXL,0
  221.  
  222.     STRUCT  CDXL_Node,MLN_SIZE      ; double linkage      
  223.     APTR    CDXL_Buffer             ; data destination (word aligned) 
  224.     LONG    CDXL_Length             ; must be even # bytes
  225.     LONG    CDXL_Actual             ; bytes transferred   
  226.     APTR    CDXL_IntData            ; interrupt server data segment
  227.     APTR    CDXL_IntCode            ; interrupt server code entry
  228.     LABEL   CDXL_SIZE
  229.  
  230.  
  231. ************************************************************************
  232. *                                                                      *
  233. * CD Table of Contents                                                 *
  234. *                                                                      *
  235. *      The CD_TOC command returns an array of CDTOC entries.           *
  236. *      Entry zero contains summary information describing how many     *
  237. *      tracks the disk has and the play-time of the disk.              *
  238. *      Entries 1 through N (N = Number of tracks on disk) contain      *
  239. *      information about the track.                                    *
  240. *                                                                      *
  241. ************************************************************************
  242.  
  243.  STRUCTURE TOCSummary,0
  244.  
  245.     UBYTE   TOCS_FirstTrack          ; First track on disk (always 1)         
  246.     UBYTE   TOCS_LastTrack           ; Last track on disk                     
  247.     STRUCT  TOCS_LeadOut,LSNMSF_SIZE ; Beginning of lead-out (end of disk)
  248.     LABEL   TOCSummary_SIZE
  249.  
  250.  
  251.  STRUCTURE TOCEntry,0
  252.  
  253.     UBYTE   TOCE_CtlAdr                 ; Q-Code info                 
  254.     UBYTE   TOCE_Track                  ; Track number                
  255.     STRUCT  TOCE_Position,LSNMSF_SIZE   ; Start position of this track
  256.     LABEL   TOCEntry_SIZE
  257.  
  258.  
  259. ;UNION
  260.  
  261. CDTOC_SIZE      equ TOCEntry_SIZE
  262.  
  263.  
  264. ************************************************************************
  265. *                                                                      *
  266. * Q-Code Packets                                                       *
  267. *                                                                      *
  268. *      Q-Code packets are only returned when audio is playing.         *
  269. *      Currently, only position packets are returned (ADR_POSITION)    *
  270. *      The other ADR_ types are almost never encoded on the disk       *
  271. *      and are of little use anyway.  To avoid making the QCode        *
  272. *      structure a union, these other ADR_ structures are not defined. *
  273. *                                                                      *
  274. ************************************************************************
  275.  
  276.  STRUCTURE QCODE,0
  277.  
  278.     UBYTE   QCODE_CtlAdr                    ; Data type / QCode type          
  279.     UBYTE   QCODE_Track                     ; Track number                    
  280.     UBYTE   QCODE_Index                     ; Track subindex number           
  281.     UBYTE   QCODE_Zero                      ; The "Zero" byte of Q-Code packet
  282.     STRUCT  QCODE_TrackPosition,LSNMSF_SIZE ; Position from start of track    
  283.     STRUCT  QCODE_DiskPosition,LSNMSF_SIZE  ; Position from start of disk     
  284.     LABEL   QCODE_SIZE
  285.  
  286.  
  287. CTLADR_CTLMASK  equ $F0     ; Control field
  288.  
  289. CTL_CTLMASK     equ $D0     ; To be ANDed with CtlAdr before compared
  290.  
  291. CTL_2AUD        equ $00     ; 2 audio channels without preemphasis            
  292. CTL_2AUDEMPH    equ $10     ; 2 audio channels with preemphasis               
  293. CTL_4AUD        equ $80     ; 4 audio channels without preemphasis            
  294. CTL_4AUDEMPH    equ $90     ; 4 audio channels with preemphasis               
  295. CTL_DATA        equ $40     ; CD-ROM Data                                     
  296.  
  297. CTL_COPYMASK    equ $20     ; To be ANDed with CtlAdr before compared
  298.  
  299. CTL_COPY        equ $20     ; When true, this audio/data can be copied        
  300.  
  301. CTLADR_ADRMASK  equ $0F     ; Address field
  302.  
  303. ADR_POSITION    equ $01     ; Q-Code is position information                  
  304. ADR_UPC         equ $02     ; Q-Code is UPC information (not used)   
  305. ADR_ISRC        equ $03     ; Q-Code is ISRC (not used)
  306. ADR_HYBRID      equ $05     ; This disk is a hybrid disk
  307.  
  308.  
  309.         ENDC
  310.